<!---- Creator: Eoly -->
<!---- On 2017/9/20 -->
<!---- Call https://palerock.cn -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title>AHook Testing 3</title>
    <style>
        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }
    </style>
    <!--<script src="ajaxHook.js"></script>-->
    <script src="../build/hooker-mini.js"></script>
    <script>
        // 方法中的this指向内部xhr[只可以调用不可以更改]，
        // this.xhr指向外部xhr可以更改可以重定义[需要用代理属性，即在属性名后面加上'_']
        aHook.register('.*/palerock.cn/h5_back/group/find-groups', {
                    hookResponse: function (e) {
//                    this.xhr.status_ = 0;
                        console.log(this);
                        return 'asdas';
                    }
                }
        );
    </script>
    <script src="lib/ajax.js"></script>
    <script src="lib/jquery-3.1.1.js"></script>
    <script>
        Ajax({
            url: 'https://palerock.cn/h5_back/group/find-groups',
            method: 'get',
            params: {goodsTypeId: 11},
            async: true
        }).then(function (res) {
            console.log(res);
        }, function (res) {
            console.log(res);
        });
        setTimeout(function () {
            Ajax({
                url: 'https://palerock.cn/h5_back/group/find-groups',
                method: 'get',
                params: {goodsTypeId: 11},
                async: true
            }).then(function (res) {
                console.log(res);
//                console.log(JSON.parse(res));
            }, function (res) {
                console.log(res);
            });
        }, 2000);

        setTimeout(function () {
            Ajax({
                url: 'https://palerock.cn/h5_back/group/find-groups',
                method: 'get',
                params: {goodsTypeId: 11},
                async: true
            }).then(function (res) {
                console.log(res);
//                console.log(JSON.parse(res));
            }, function (res) {
                console.log(res);
            });
        }, 4000);

        setTimeout(function () {
            Ajax({
                url: 'https://palerock.cn/h5_back/group/find-groups',
                method: 'get',
                params: {goodsTypeId: 11},
                async: true
            }).then(function (res) {
                console.log(res);
//                console.log(JSON.parse(res));
            }, function (res) {
                console.log(res);
            });
        }, 6000);

    </script>
</head>
<body>

</body>
</html>